/*   1:    */ package com.rinsi.util;
/*   2:    */ 
/*   3:    */ import java.util.Collection;
/*   4:    */ import java.util.Map;
/*   5:    */ import java.util.regex.Matcher;
/*   6:    */ import java.util.regex.Pattern;
/*   7:    */ 
/*   8:    */ public class AssertUtil
/*   9:    */ {
/*  10:    */   public static boolean isStringNotEmpty(Object obj)
/*  11:    */   {
/*  12: 29 */     if (obj == null) {
/*  13: 29 */       return false;
/*  14:    */     }
/*  15: 31 */     if (obj.toString().trim().length() == 0) {
/*  16: 31 */       return false;
/*  17:    */     }
/*  18: 33 */     return true;
/*  19:    */   }
/*  20:    */   
/*  21:    */   public static boolean isIntegerNotEmpty(Object obj)
/*  22:    */   {
/*  23: 45 */     if (obj == null) {
/*  24: 45 */       return false;
/*  25:    */     }
/*  26: 47 */     if (!(obj instanceof Integer)) {
/*  27: 47 */       return false;
/*  28:    */     }
/*  29: 49 */     if (Integer.valueOf(obj.toString()).intValue() != 0) {
/*  30: 49 */       return false;
/*  31:    */     }
/*  32: 51 */     return true;
/*  33:    */   }
/*  34:    */   
/*  35:    */   public static boolean isMapNotEmpty(Object obj)
/*  36:    */   {
/*  37: 63 */     if (obj == null) {
/*  38: 63 */       return false;
/*  39:    */     }
/*  40: 65 */     if (!(obj instanceof Map)) {
/*  41: 65 */       return false;
/*  42:    */     }
/*  43: 67 */     if (((Map)obj).isEmpty()) {
/*  44: 67 */       return false;
/*  45:    */     }
/*  46: 69 */     return true;
/*  47:    */   }
/*  48:    */   
/*  49:    */   public static boolean isCollectionNotEmpty(Object obj)
/*  50:    */   {
/*  51: 81 */     if (obj == null) {
/*  52: 81 */       return false;
/*  53:    */     }
/*  54: 83 */     if (!(obj instanceof Collection)) {
/*  55: 83 */       return false;
/*  56:    */     }
/*  57: 85 */     if (((Collection)obj).isEmpty()) {
/*  58: 85 */       return false;
/*  59:    */     }
/*  60: 87 */     return true;
/*  61:    */   }
/*  62:    */   
/*  63:    */   public static boolean isInteger(Object obj)
/*  64:    */   {
/*  65: 99 */     if (obj == null) {
/*  66: 99 */       return false;
/*  67:    */     }
/*  68:101 */     Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
/*  69:    */     
/*  70:103 */     return pattern.matcher(String.valueOf(obj)).matches();
/*  71:    */   }
/*  72:    */   
/*  73:    */   public static boolean isBoolean(Object obj)
/*  74:    */   {
/*  75:116 */     if (obj == null) {
/*  76:116 */       return false;
/*  77:    */     }
/*  78:118 */     return (String.valueOf(obj).equals("true")) || (String.valueOf(obj).equals("false"));
/*  79:    */   }
/*  80:    */   
/*  81:    */   public static boolean isFloat(Object obj)
/*  82:    */   {
/*  83:131 */     if (obj == null) {
/*  84:131 */       return false;
/*  85:    */     }
/*  86:133 */     Pattern pattern = Pattern.compile("^[-\\+]?[.\\d]*$");
/*  87:    */     
/*  88:135 */     return pattern.matcher(String.valueOf(obj)).matches();
/*  89:    */   }
/*  90:    */   
/*  91:    */   public static boolean isNumber(Object obj)
/*  92:    */   {
/*  93:147 */     if (obj == null) {
/*  94:147 */       return false;
/*  95:    */     }
/*  96:149 */     if (isInteger(obj)) {
/*  97:149 */       return true;
/*  98:    */     }
/*  99:151 */     return isFloat(obj);
/* 100:    */   }
/* 101:    */ }


/* Location:           D:\Users\Desktop\shanxi\项目\sxazmis\WEB-INF\classes\
 * Qualified Name:     com.rinsi.util.AssertUtil
 * JD-Core Version:    0.7.0.1
 */